import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: () => import('@/layout/index'),
        redirect: '/dashboard',
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: ()=>import('@/views/Dashboard.vue'),
                meta: {title: '首页'}
            },
            {
                path: 'profile',
                name: 'Profile',
                component: ()=>import('@/views/Profile.vue'),
                meta: {title: '个人中心'}
            },
        ]
    },
    {
        path: '/system',
        name: 'System',
        component: () => import('@/layout/index'),
        meta:{title:'系统管理'},
        children: [
            {
                path: 'user',
                name: 'User',
                component: ()=>import('@/views/system/User.vue'),
                meta: {title: '用户管理'}
            }
        ]
    },
    {
        path: '/info',
        name: 'Info',
        component: () => import('@/layout/index'),
        meta:{title:'信息管理'},
        children: [
            {
                path: 'Student',
                name: 'Student',
                component: ()=>import('@/views/info/Student.vue'),
                meta: {title: '学生管理'}
            },
            {
                path: 'teacher',
                name: 'Teacher',
                component: ()=>import('@/views/info/Teacher.vue'),
                meta: {title: '教师管理'}
            },
            {
                path: 'course',
                name: 'Course',
                component: ()=>import('@/views/info/Course.vue'),
                meta: {title: '课程管理'}
            },
        ]
    },
    {
        path: '/educational',
        name: 'Educational',
        component: () => import('@/layout/index'),
        meta:{title:'教务管理'},
        children: [
            {
                path: 'assigned',
                name: 'Assigned',
                component: ()=>import('@/views/educational/Assigned.vue'),
                meta: {title: '课程安排'}
            },
            {
                path: 'attendance',
                name: 'Attendance',
                component: ()=>import('@/views/educational/Attendance.vue'),
                meta: {title: '考勤记录'}
            },
        ]
    },
    {
        path:'/login',
        name:'Login',
        component:()=>import('@/views/Login.vue'),
    }
];

export default new Router({
    
    mode: 'history', 
    routes: routes
})